from pyecharts import options as opts
from pyecharts.charts import WordCloud
from pyecharts.globals import SymbolType
import os

# Add word frequency data
words = [
    ("mCode", 10000),
    ("mBlock", 6181),
    ("慧编程", 4386),
    ("童心制物", 4055),
    ("人工智能", 3660),
    ("南山小熊猫", 2467),
    ("STEAM教育", 2244),
    ("创造的乐趣", 1868),
    ("AI", 1560),
    ("mBot", 1484),
    ("程小奔", 1112),
    ("数据科学", 982),
    ("童小点", 865),
    ("激光打印机", 847),
    ("神经元", 582),
    ("光环板", 555),
    ("树莓派", 550),
    ("Ardunio", 462),
]

# WordCloud module,Chain Call Configuration, creat the html file
c = (
    WordCloud()
    .add("", words, word_size_range=[20, 100], shape=SymbolType.DIAMOND)
    .set_global_opts(title_opts=opts.TitleOpts(title="WordCloud-shape-diamond"))
    .render("wordcloud.html")
)
os.system("wordcloud.html")